<?php 


class DatabaseConnection {

	public function __construct($host, $un, $pw, $tbl_name){
		if (!@$this->Connect($host, $un, $pw, $tbl_name)) {
			echo "Connection Failed";
		}else if ($this->Connect($host, $un, $pw, $tbl_name)) {
			//echo 'connected to ' . $tbl_name;
		}
	}


	public function Connect($host, $un, $pw, $tbl_name) {
		if ($con = mysql_connect($host, $un, $pw, $tbl_name)) {
		 	return true;
		}else {
			return false;
		}
	}

}

class selectdb{

		public function __construct($db_name){
			if (!@$this->selectDb($db_name)) {
				echo "couldnt select db";
			}else if ($this->selectDb($db_name)) {
				//echo "you are in " . $db_name ;
			}
		}

	public function selectDb($db_name){
				if (mysql_select_db($db_name)) {
					return true;
				}else {
					return false;
				}
		}
}



/*class Select{

		public function __construct($tbl_name){

			if (!@$this->Select($tbl_name)) {

				echo "hindi nakuha ang db";
				
			}else if($this->Select($tbl_name)) {
				echo  $tbl_name;
			}		
		}

		public function theDb($tbl_name){
			
			$qry ="SELECT * FROM $tbl_name WHERE login='$login' AND password='".md5($_POST['password'])."'";
		}
}*/


?>